package com.jdz.gxq.info.admin.trade.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.jdz.gxq.info.admin.trade.service.TradeService;
import com.jdz.gxq.info.common.action.CommonAction;

public class DeleteTradeAction extends CommonAction {

	private TradeService tradeService = null;
	 
	public ActionForward doExecute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws java.lang.Exception {
		
		String enterpriseIdStr = request.getParameter("id");
		
		String[] enterpriseIds = enterpriseIdStr.split(",");
		
		for (String enterpriseId : enterpriseIds) {
			tradeService.deleteTrade(Integer.parseInt(enterpriseId));
		}

		return mapping.findForward("success");
	}

	public void setTradeService(TradeService tradeService) {
		this.tradeService = tradeService;
	}
}

